<template>
  <div>
    <van-nav-bar :title="$route.meta.title"  @click-right="$router.push('/search')" >
      <template #right>
        <van-icon name="search" size="18"  />
      </template>
    </van-nav-bar>
    <div class="userinfo" style="padding:20px;text-align:center;">
        <van-image
        round
        width="80px"
        height="80px"
        src="https://img.yzcdn.cn/vant/cat.jpeg"
      />
      <p>{{ haslogin ? nickname : '请登录' }}</p>
      <br>

      <br>
      <br>
      
      

      <van-button type="danger"  v-if="haslogin"  @click="quit"  block>立即退出</van-button>
      <van-button type="primary"  v-if="!haslogin" to="/login" block>请登录</van-button>
    </div>
    <van-cell title="地址管理"  icon="cart-o" is-link to="/user/address" />
    <van-cell title="收藏管理" icon="cart-o" />
   
  </div>
</template>

<script>
import { mapGetters,mapState,mapActions }  from "vuex"
export default {
    data(){
        return{
        }
    },
    computed:{
      ...mapState(['haslogin']),
      ...mapGetters(['nickname'])
     
    },
    created(){
      
    },
    methods:{
       ...mapActions({
         quit:"user/quit"
       })
    },
    components:{}
}

</script>
<style scoped>
</style>